
#ifndef EpollHandle_H
#define EpollHandle_H

#include <sys/epoll.h>

#define EPOLL_SIZE  1024
#define EPOLL_RUN_TIMEOUT 30

class EPollObserver
{
public:
    virtual void OnHandleData(int, int) = 0;
	
};


class EpollHandle
{
public:
    EpollHandle( int listenfd, EPollObserver *ob);
    ~EpollHandle();
    void epoll_do_wait();
    void epoll_handle();
    void epoll_close();

    void epoll_add_fd(int fd);
    void epoll_del_fd(int fd);

protected:
	EPollObserver*         mObserver;

private:
    int epollfd_;
    struct epoll_event events_[EPOLL_SIZE];
    int listenfd_;
    int nready_;
    clock_t tStart; 
   
    
};

#endif // EpollHandle_H
